#ifndef __HTTPCONTENT_H__
#define __HTTPCONTENT_H__

#include "httprequest.h"
#include "httpparsestate.h"

namespace tiny_muduo
{
    enum HttpRequestParseLine
    {
        kLineOk,
        kLineMore,
        kLineErrno,
    };

    class Buffer;

    class HttpContent
    {
    public:
        HttpContent();
        ~HttpContent();

        bool ParseContent(Buffer* buffer);
        bool IsCompleteRequest() { return parse_state_ == kParseGotCompleteRequst; }

        const HttpRequest& request() const { return request_; }
        void ResetContentState()
        {
            HttpRequest tmp;
            request_.Swap(tmp);
            parse_state_ = kParseRequestLine;
        }

    private:
        HttpRequest request_;
        HttpRequestParseState parse_state_;
    };
}
#endif
